// @ts-ignore
/* eslint-disable */
import request from "@/util/request.ts";

/** 此处后端没有提供注释 POST /book/add */
export async function addBook(
  body: API.AddBookDTO,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseLong>("/book/add", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /book/category/statistics */
export async function getCategoryStatistics(options?: { [key: string]: any }) {
  return request<API.BaseResponseListCategoryStatisticsDTO>(
    "/book/category/statistics",
    {
      method: "GET",
      ...(options || {}),
    }
  );
}

/** 此处后端没有提供注释 POST /book/delete/${param0} */
export async function deleteBook(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteBookParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(`/book/delete/${param0}`, {
    method: "POST",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /book/get/${param0} */
export async function getBookById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getBookByIdParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseBook>(`/book/get/${param0}`, {
    method: "GET",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /book/list/page */
export async function listBookByPage(
  body: API.BookQueryRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageBook>("/book/list/page", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /book/update */
export async function updateBook(
  body: API.UpdateBookDTO,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean>("/book/update", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}
